package cn.funnyxb.powerremember.uis.task.done.study;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import java.util.ArrayList;
import java.util.Iterator;

public class StudyConfiger
{
  public static final int DIFDIFFICULT_MAX = 9;
  public static final int MODE_DEFAULT = 2;
  public static final int MODE_LATER_MEANING = 3;
  public static final int MODE_LATER_WORD = 2;
  public static final int MODE_NORMAL = 1;
  public static final int[] PAGESIZES;
  private static final String SharedPreferencesName = "powerconfig";
  private static StudyConfiger config;
  private static final String key_isEnableAdjustDifficulty = "key_isEnableAdjustDifficulty";
  private static final String key_mode = "key_mode";
  private static final String key_pageSizeId = "key_pageSizeid";
  private static final String key_showPhoneticAfterClick = "key_showPhoneticAfterClick";
  private static final String key_showStyleId = "key_showStyleId";
  private static final String key_speechWhenClick = "key_speechWhenClick";
  private Context context;
  private ArrayList<Integer> difficultys;
  private boolean isEnableAdjustDifficultyByBtn = true;
  private String key_difficulty = "key_difficulty";
  private int mode = 2;
  private int pageSizeId = 0;
  private boolean showPhoneticAfterClick = false;
  private int showStyleId = 0;
  private boolean speechWhenClick = true;

  static
  {
    int[] arrayOfInt = new int[3];
    arrayOfInt[0] = 5;
    arrayOfInt[1] = 10;
    arrayOfInt[2] = 20;
    PAGESIZES = arrayOfInt;
  }

  private StudyConfiger(Context paramContext)
  {
    this.context = paramContext;
    loadConfig();
  }

  public static StudyConfiger getConfig(Context paramContext)
  {
    if (config == null)
      config = new StudyConfiger(paramContext);
    return config;
  }

  private void loadConfig()
  {
    SharedPreferences localSharedPreferences = this.context.getSharedPreferences("powerconfig", 0);
    this.mode = localSharedPreferences.getInt("key_mode", 2);
    this.speechWhenClick = localSharedPreferences.getBoolean("key_speechWhenClick", true);
    this.showPhoneticAfterClick = localSharedPreferences.getBoolean("key_showPhoneticAfterClick", false);
    this.isEnableAdjustDifficultyByBtn = localSharedPreferences.getBoolean("key_isEnableAdjustDifficulty", true);
    this.pageSizeId = localSharedPreferences.getInt("key_pageSizeid", 0);
    this.showStyleId = localSharedPreferences.getInt("key_showStyleId", 0);
    this.difficultys = readDifficultys();
  }

  private ArrayList<Integer> readDifficultys()
  {
    String str = this.context.getSharedPreferences("powerconfig", 0).getString(this.key_difficulty, null);
    Object localObject;
    if ((str == null) || (str.trim().length() == 0))
    {
      localObject = null;
      return localObject;
    }
    ArrayList localArrayList = new ArrayList();
    char[] arrayOfChar = str.toCharArray();
    int i = arrayOfChar.length;
    for (int j = 0; ; ++j)
    {
      if (j >= i)
        localObject = localArrayList;
      localArrayList.add(Integer.valueOf(Integer.parseInt(arrayOfChar[j])));
    }
  }

  private void saveDifficultys(ArrayList<Integer> paramArrayList)
  {
    String str = "";
    Iterator localIterator;
    if ((paramArrayList != null) && (paramArrayList.size() != 0))
      localIterator = paramArrayList.iterator();
    while (true)
    {
      if (!(localIterator.hasNext()))
      {
        this.context.getSharedPreferences("powerconfig", 0).edit().putString(this.key_difficulty, str).commit();
        return;
      }
      int i = ((Integer)localIterator.next()).intValue();
      str = str + i;
    }
  }

  public ArrayList<Integer> getDifficultys()
  {
    return this.difficultys;
  }

  public int getMode()
  {
    return this.mode;
  }

  public int getPageSize()
  {
    return PAGESIZES[this.pageSizeId];
  }

  public int getPageSizeId()
  {
    return this.pageSizeId;
  }

  public int getShowStyleId()
  {
    return this.showStyleId;
  }

  public boolean isEnableAdjustDifficultyByBtn()
  {
    return this.isEnableAdjustDifficultyByBtn;
  }

  public boolean isShowPhoneticAfterClick()
  {
    return this.showPhoneticAfterClick;
  }

  public boolean isSpeechWhenClick()
  {
    return this.speechWhenClick;
  }

  public void setDifficultys(ArrayList<Integer> paramArrayList)
  {
    this.difficultys = paramArrayList;
    saveDifficultys(paramArrayList);
  }

  public void setEnableAdjustDifficultyByBtn(boolean paramBoolean)
  {
    this.isEnableAdjustDifficultyByBtn = paramBoolean;
    this.context.getSharedPreferences("powerconfig", 0).edit().putBoolean("key_isEnableAdjustDifficulty", paramBoolean).commit();
  }

  public void setMode(int paramInt)
  {
    this.mode = paramInt;
    this.context.getSharedPreferences("powerconfig", 0).edit().putInt("key_mode", paramInt).commit();
  }

  public void setPageSizeId(int paramInt)
  {
    this.pageSizeId = paramInt;
    this.context.getSharedPreferences("powerconfig", 0).edit().putInt("key_pageSizeid", paramInt).commit();
  }

  public void setShowPhoneticAfterClick(boolean paramBoolean)
  {
    this.showPhoneticAfterClick = paramBoolean;
    this.context.getSharedPreferences("powerconfig", 0).edit().putBoolean("key_showPhoneticAfterClick", paramBoolean).commit();
  }

  public void setShowStyleId(int paramInt)
  {
    this.showStyleId = paramInt;
    this.context.getSharedPreferences("powerconfig", 0).edit().putInt("key_showStyleId", paramInt).commit();
  }

  public void setSpeechWhenClick(boolean paramBoolean)
  {
    this.speechWhenClick = paramBoolean;
    this.context.getSharedPreferences("powerconfig", 0).edit().putBoolean("key_showPhoneticAfterClick", paramBoolean).commit();
  }
}

/* Location:           E:\Desktop\复件 classes_dex2jar.jar
 * Qualified Name:     cn.funnyxb.powerremember.uis.task.done.study.StudyConfiger
 * JD-Core Version:    0.5.3
 */